package day03;

public class Test {
    public static void main(String[] args) {
        User u=new User();
        Customer c=new Customer();
        Seller s=new Seller();
        c.name="小白";
        s.name="小红";
        c.searchOrders();
        s.searchProducts();

        /*继承中的构造方法测试*/
        Ipad air2=new Ipad(9.7,8759);
        System.out.println("屏幕："+air2.screen+";电池："+air2.battery);
        IPhone if6=new IPhone(4.7,1810,"12312345");
        System.out.println("屏幕"+if6.screen+";电池；"+if6.battery+";手机号："+if6.mobile);
        /*向上转型的测试*/
        Ipad charger;
        charger=air2;//编译正确：air2本来就是Ipad类型
        charger=if6;//编译正确
        charger(charger);
        charger(air2);

        System.out.println(if6.mobile);
        //System.out.println(charger.mobile);
    }
    public static void charger(Ipad charger){
        System.out.println(charger.toString()+"正在充电...");
    }
}
class Ipad{
    double screen;//屏幕大小
    int battery;//电池容量
    //编译器自动生成
    Ipad(){
        this.screen=0.0;
        this.battery=0;
    }
    Ipad(double screen,int battery){
        this.screen=screen;
        this.battery=battery;
    }
}
class IPhone extends Ipad{
    String mobile;//手机号
    //编译器自动生成
    /*IPhone(){
        this.mobile=null;
    }*/
    IPhone(double screen,int battery,String mobile){
        super(screen,battery);
        this.mobile=mobile;
    }
}
